Configuration cInstallerEnvironmentVariables
{

    param (
	[Parameter(Mandatory)]
	[ValidateNotNullOrEmpty()]
	[PSObject]$ManagedServer
    )

    Import-DSCResource -ModuleName xPowerShellExecutionPolicy
    Import-Module Application.Management.psd1 -Force

    #Log Message
    Log cInstallerEnvironmentVariablesBegin {
        Message = "Start cInstallerEnvironmentVariables for $($ManagedServer.Name)"
    } 


    xPowerShellExecutionPolicy ExecutionPolicy
    {
        ExecutionPolicy = "Unrestricted"
    }


    $environmentVariables =  Get-EnvironmentVariables -ManagedServer $ManagedServer

    foreach($environmentVariableKey in $environmentVariables.keys)
    {
        Environment "EnvironmentVariable_$environmentVariableKey"
        {
            Ensure = "Present"  # You can also set Ensure to "Absent"
            Path = ($environmentVariableKey -like '*path')
            Name = $environmentVariableKey
            Value = $environmentVariables.$environmentVariableKey
        }
    }

    #Log Message
    Log cInstallerEnvironmentVariablesEnd {
        Message = "End cInstallerEnvironmentVariables for $($ManagedServer.Name)"
    } 

}